<%@page_title = "用户注册 - 大满足日本语"%>
<script type="text/javascript">
  $().ready(function() {
    $("#signup_form").validate({
      rules: { "account[login]": {
          required: true,
          rangelength: [5,20],
          remote:"/accounts/valid_login_exist"
        },"account[email]": {
          required: true,
          email: true,
          maxlength:30,
          remote:"/accounts/valid_email_exist"
        },"account[password]": {
          required: true,
          rangelength: [6,16]
        },"account[password_confirmation]": {
          required: true,
          rangelength: [6,16],
          equalTo : "#account_password"
        },"captcha": {
          required: true
        }
      },
      messages:{
        "account[login]": {
          required: "请输入用户名",
          rangelength: "用户名长度必须在5-20个字符之间",
          remote: "用户名已存在"
        },"account[email]": {
          required: "请输入邮箱",
          email:"请输入有效邮件地址",
          maxlength: "邮箱的最大长度不能超过30个字符",
          remote: "邮箱已存在"
        },"account[password]": {
          required: "请输入密码",
          rangelength: "密码长度必须在6-16个字符之间"
        },"account[password_confirmation]": {
          required: "请再输入一次密码",
          rangelength: "密码长度必须在6-16个字符之间",
          equalTo: "两次密码不一致"
        },"captcha": {
          required: "请输入验证码"
        }
      },
      errorPlacement: function(error,element){
        error.appendTo(element.next());
      }
    });
  });
</script>
<div id="main_body">
  <div class="sub_pannel">
    <div class="login_pannel signup_pannel">
      <div class="content">
        <h5>用户登录</h5>
        <% form_for :account, :url => accounts_path, :html => {:id => 'signup_form'} do |f| -%>
          <%=error_messages_for :account %>
          <%unless flash.now[:notice].nil?%>
            <div id="message_box" style="display:block;">
              <div class="e_message"><%=flash.now[:notice]%></div>
            </div>
          <%end%>
          <p>
            <%= label_tag "login" ,"用户名:" ,:class=>'label' %>
            <%= f.text_field :login,:class=>"text" %>
            <span></span>
            <span class="note_text">用户名不能为空，5-20个字符.</span>
          </p>
          <p>
            <%= label_tag "email","电子邮箱:" ,:class=>'label' %>
            <%= f.text_field :email,:class=>"text" %>
            <span></span>
            <span class="note_text">例如: 123@gmail.com</span>
          </p>
          <p>
            <%= label_tag "password","密码:" ,:class=>'label' %>
            <%= f.password_field :password,:class=>"text" %>
            <span></span>
            <span class="note_text">6-20个字符.</span>
          </p>
          <p>
            <%= label_tag "email","确认密码:" ,:class=>'label' %>
            <%= f.password_field :password_confirmation,:class=>"text" %>
            <span></span>
          </p>
          <div style="margin-left:50px;">
            <%= show_simple_captcha %>
            <span></span>
          </div>
          <p class="p_submit">
            <%= submit_tag "注册"  ,:class=>'submit' %>
          </p>
        <%end%>
      </div>
    </div>
  </div>
</div>